package api

/**
  * Created by chenbo on 2018/12/27.
  */
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class run_test extends Simulation{

  val site = Array(
    Map("WebSiteSysNo"->1,"DeliverySysNo"->2,"offset"->0),
    Map("WebSiteSysNo"->2,"DeliverySysNo"->244,"offset"->8),
    Map("WebSiteSysNo"->3,"DeliverySysNo"->120,"offset"->16)
  ).random

  var uuk:String = java.util.UUID.randomUUID().toString.replaceAll("-","")


  val demo_test = scenario("homepage")
    .feed(site)
    .exec(_.set("uuk",uuk))
    .exec(homePage.home_page_s)
    .exec(homePage.home_page_c)
    .exec(homePage.home_page_info)

  val basic = http.baseURL("http://192.168.60.32:80")
    .header("User-Agent","BenLai/4.4.0 (iPhone; iOS 9.3.3; Scale/2.00)")

  setUp(
    demo_test.inject(
      rampUsersPerSec(1) to 1 during( 600 seconds)
    )
  ).protocols(basic)

}